package com.jay.math.clazz;

import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;

public class MathContextCls {
	public static void main(String[] args) {
		MathContext mc1 = new MathContext(4, RoundingMode.HALF_DOWN);
		double d1 = 1.234d;
		double d2 = 9.8765d;

		BigDecimal bd1 = new BigDecimal(d1);
		BigDecimal bd2 = new BigDecimal(d2);
		System.out.println(bd1.add(bd2, mc1));
		System.out.println(bd1.add(bd2));
	}
}
